Skip to content

Add __getattr__ typing hints to Record class#169

Merged
yunzheng merged 2 commits intomainfrom
record-typing-hints
Jun 20, 2025
Merged

Add __getattr__ typing hints to Record class#169
yunzheng merged 2 commits intomainfrom
record-typing-hints

Conversation

@yunzheng
Copy link
Member

This improves support for type checkers when using Records.

This improves support for type checkers when using Records.
@codecov
Copy link

codecov bot commented Jun 17, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 82.82%. Comparing base (18b5920) to head (4e8c711).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
flow/record/base.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #169      +/-   ##
==========================================
- Coverage   82.84%   82.82%   -0.02%     
==========================================
  Files          34       34              
  Lines        3574     3576       +2     
==========================================
+ Hits         2961     2962       +1     
- Misses        613      614       +1     
Flag Coverage Δ
unittests 82.82% <50.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@yunzheng yunzheng requested a review from Copilot June 17, 2025 13:52
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a type hint for the getattr method in the Record class to improve support for type checkers.

  • Adds an getattr signature under a TYPE_CHECKING block to avoid runtime overhead while improving static analysis.
Comments suppressed due to low confidence (1)

flow/record/base.py:189

  • Consider adding a comment clarifying that getattr is defined within a TYPE_CHECKING block solely for static analysis, and it does not impact runtime behavior.
        def __getattr__(self, name: str) -> Any: ...

@yunzheng yunzheng merged commit 1476f7a into main Jun 20, 2025
22 of 24 checks passed
@yunzheng yunzheng deleted the record-typing-hints branch June 20, 2025 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants